// pages/personArticle/personArticle.js
let app = getApp();
Page({

  /**
   * 页面的初始数据
   */
   data: {
    isweek:'',
    artcleId:'',
    article:{

      startingPlace:'',
      destination:'',
      beginTime: '',
      beginDetailTime:'06:00',
      expectBeginPlace:'',
      userName:'',
      phoneNum:'',
      passengerNum:'',
      shareMark:'',
    }
  },

  callUpCall(e){
    let self = this;
    wx.makePhoneCall({
      phoneNumber: e.currentTarget.dataset.phone,
      success(res){
        //添加敢兴趣的 乘客
        wx.request({
          url: app.globalData.serverUrl + 'CarShareMessage/interactionCarShareMessageById.do',
          data:{
            openId: app.globalData.serverOpenInfo.openid,
            id: self.data.article.id
          },
          success(res){
            console.log(res)

          }

        })
      }
    })
  },


  /**
   * 生命周期函数--监听页面加载
   */
   onLoad: function (options) {
    let self = this
    console.log(options.artcleId)

    this.setData({
      artcleId: options.artcleId
    })

     wx.request({
      url: app.globalData.serverUrl+'CarShareMessage/queryCarShareMessageById.do',
      data:{id:options.artcleId},
      success(res){
        console.log(res.data.data.shareMessge);
        if (res.data.state == 1) {
          let dataInfo = res.data.data.shareMessge;
          dataInfo.userName = res.data.data.userName;
          dataInfo.phoneNum = res.data.data.phoneNum;


          self.setData({
            article: dataInfo,
            
          })
        }
      }
    })

    

   },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
   onReady: function () {

   },

  /**
   * 生命周期函数--监听页面显示
   */
   onShow: function () {

   },

  /**
   * 生命周期函数--监听页面隐藏
   */
   onHide: function () {

   },

  /**
   * 生命周期函数--监听页面卸载
   */
   onUnload: function () {

   },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
   onPullDownRefresh: function () {

   },

  /**
   * 页面上拉触底事件的处理函数
   */
   onReachBottom: function () {

   },

  /**
   * 用户点击右上角分享
   */
   onShareAppMessage: function () {
    return {
      title: this.data.article.startingPlace+'--'+this.data.article.destination,
      path: '/pages/personArticle/personArticle?openid='+ app.globalData.serverOpenInfo.openid+'&artcleId='+this.data.artcleId
    }

   }
 })